﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var sitemain_js_sitename_empty = "_{sitemain_js_sitename_empty}";
	var sitemain_js_sitedir_err = "_{sitemain_js_sitedir_err}";
	var sitemain_js_sitecode_err = "_{sitemain_js_sitecode_err}";
	var sitemain_js_siteip_err = "_{sitemain_js_siteip_err}";
	var sitemain_js_sitehttp_err = "_{sitemain_js_sitehttp_err}";
	var sitemain_js_adminusername_err = "_{sitemain_js_adminusername_err}";
	
	var sitemain_js_edit_ok = "_{sitemain_js_edit_ok}";
	var sitemain_js_edit_no = "_{sitemain_js_edit_no}";
	var iframename = "#{iframename}";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
	    var h = '#{iframeheightwindow}';
		$('.managebottonadd').css({height:h-40});
		var options = {

			beforeSubmit: formverify,

			success:saveResponse,
			resetForm: true
		}
		$('#formmain').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['sitename']==""){
			document.formmain.sitename.focus();
			alert(sitemain_js_sitename_empty);
			return false;
		}
		if(get['sitehttp'].match(/^http:\/\/[a-zA-Z.0-9/_]+$/ig)==null) {
			document.formmain.sitehttp.focus();
			alert(sitemain_js_sitehttp_err);
			return false;
		}
		if(get['sitedir'].match(/^[\w-]+$/ig)==null) {
			document.formmain.sitedir.focus();
			alert(sitemain_js_sitedir_err);
			return false;
		}
		if(get['sitecode']=="" || get['sitecode'].length<15){
			document.formmain.sitecode.focus();
			alert(sitemain_js_sitecode_err);
			return false;
		}
		if(get['siteip'].match(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/ig)==null){
			document.formmain.siteip.focus();
			alert(sitemain_js_siteip_err);
			return false;
		}
		if(get['adminusername']==""){
			document.formmain.adminusername.focus();
			alert(sitemain_js_adminusername_err);
			return false;
		}
		parent.windowsdig('Loading', 'iframe:#{load}', '400px', '180px', 'iframe', false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			parent.frames[iframename].refresh('selectform','selectall','check_all');
			alert(sitemain_js_edit_ok);
		}else{
			alert(sitemain_js_edit_no+options);
		}
		parent.onaletdoc()
	}
</script>
</head>

<body>
<form name="formmain" id="formmain" method="post" action="#{ActionLink}">
<input type="hidden" name="tab" id="formmaintab" value="#{tab}" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{sitemain_edit_mess}</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr class="trstyle2">
						<td class="trtitle011">_{sitemain_add_sitename}</td>
						<td class="trtitle02"><input type="text" name="sitename" size="30" value="#{read.sitename}" maxlength="80" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_sitename_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">_{sitemain_add_sitehttp}</td>
						<td  class="trtitle02"><input type="text" name="sitehttp" value="#{read.sitehttp}" size="50" maxlength="100" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_sitehttp_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{sitemain_add_sitedir}</td>
						<td class="trtitle02"><input type="text" name="sitedir" size="20" value="#{read.sitedir}"  maxlength="20" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_sitedir_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">_{sitemain_add_sitecode}</td>
						<td class="trtitle02"><input type="text" name="sitecode" size="80" value="#{read.sitecode}" maxlength="100" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_sitecode_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">_{sitemain_add_siteip}</td>
						<td class="trtitle02"><input type="text" name="siteip" size="20" value="#{read.siteip}" maxlength="20" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_siteip_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle011">_{sitemain_add_adminusername}</td>
						<td class="trtitle02"><input type="text" name="adminusername" size="20" value="#{read.adminusername}" maxlength="50" class="infoInput"/> <span class="cautiontitle">_{sitemain_add_adminusername_mess}</span></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="submitbotton" name="Submit" value="_{botton_edit}" class="buttonface" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="_{botton_edit_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>

</html>